package util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Created by Administrator on 2019/3/20.
 */
public class ConfingManager {
    static ConfingManager confingManager;
    Properties pro;

    public ConfingManager() {
        pro=new Properties();
        InputStream is=ConfingManager.class.getClassLoader().getResourceAsStream("database.properties");
        try {
         pro.load(is);
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                if (is!=null) {
                    is.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    //懒汉模式
    public static ConfingManager getInstance(){
        if (confingManager==null){
            confingManager=new ConfingManager();
        }
        return confingManager;
    }

    public String getValues(String key){
        return pro.getProperty(key);
    }
}
